package cn.pms.po;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import cn.pms.type.MessageState;
import cn.pms.type.MessageType;

/**
 * Message entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "t_message", schema = "SCOTT")
public class Message implements java.io.Serializable
{
	private static final long serialVersionUID = -562065224522554788L;
	// Fields
	private Integer id;
	private Date dateByBeginDateId;
	private Date dateByEndDateId;
	private Employee employee;
	private Department department;
	private Date dateByDateId;
	private MessageType msgType;
	private MessageState msgState;
	private String reason;
	private String remark;
	
	// Constructors
	/** default constructor */
	public Message()
	{}
	
	/** minimal constructor */
	public Message(Date dateByBeginDateId, Employee employee,
			Department department, Date dateByDateId, MessageType msgType,
			MessageState msgState)
	{
		this.dateByBeginDateId = dateByBeginDateId;
		this.employee = employee;
		this.department = department;
		this.dateByDateId = dateByDateId;
		this.msgType = msgType;
		this.msgState = msgState;
	}
	
	/** full constructor */
	public Message(Date dateByBeginDateId, Date dateByEndDateId,
			Employee employee, Department department, Date dateByDateId,
			MessageType msgType, MessageState msgState, String reason,
			String remark)
	{
		this.dateByBeginDateId = dateByBeginDateId;
		this.dateByEndDateId = dateByEndDateId;
		this.employee = employee;
		this.department = department;
		this.dateByDateId = dateByDateId;
		this.msgType = msgType;
		this.msgState = msgState;
		this.reason = reason;
		this.remark = remark;
	}
	
	// Property accessors
	@Id
	@Column(name = "id", unique = true, nullable = false, precision = 32, scale = 0)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_MSG")
	@SequenceGenerator(name = "SEQ_MSG", sequenceName = "SEQ_MSG",allocationSize=1)
	public Integer getId()
	{
		return this.id;
	}
	
	public void setId(Integer id)
	{
		this.id = id;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "beginDateId", nullable = false)
	public Date getDateByBeginDateId()
	{
		return this.dateByBeginDateId;
	}
	
	public void setDateByBeginDateId(Date dateByBeginDateId)
	{
		this.dateByBeginDateId = dateByBeginDateId;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "endDateId")
	public Date getDateByEndDateId()
	{
		return this.dateByEndDateId;
	}
	
	public void setDateByEndDateId(Date dateByEndDateId)
	{
		this.dateByEndDateId = dateByEndDateId;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "empId", nullable = false)
	public Employee getEmployee()
	{
		return this.employee;
	}
	
	public void setEmployee(Employee employee)
	{
		this.employee = employee;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "depId", nullable = false)
	public Department getDepartment()
	{
		return this.department;
	}
	
	public void setDepartment(Department department)
	{
		this.department = department;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "dateId", nullable = false)
	public Date getDateByDateId()
	{
		return this.dateByDateId;
	}
	
	public void setDateByDateId(Date dateByDateId)
	{
		this.dateByDateId = dateByDateId;
	}
	
	@Column(name = "msgType", nullable = false, length = 100)
	@Enumerated(EnumType.STRING)
	public MessageType getMsgType()
	{
		return this.msgType;
	}
	
	public void setMsgType(MessageType msgType)
	{
		this.msgType = msgType;
	}
	
	@Column(name = "msgState", nullable = false, length = 100)
	@Enumerated(EnumType.STRING)
	public MessageState getMsgState()
	{
		return this.msgState;
	}
	
	public void setMsgState(MessageState msgState)
	{
		this.msgState = msgState;
	}
	
	@Column(name = "reason", length = 100)
	public String getReason()
	{
		return this.reason;
	}
	
	public void setReason(String reason)
	{
		this.reason = reason;
	}
	
	@Column(name = "remark", length = 100)
	public String getRemark()
	{
		return this.remark;
	}
	
	public void setRemark(String remark)
	{
		this.remark = remark;
	}
}
